# from flask import Blueprint, jsonify
from quart import Blueprint, jsonify
ping_api_bt = Blueprint('heartbeat api', __name__, url_prefix='/api')

@ping_api_bt.route('/ping', methods=['GET'])
def ping():
    """
       ping api - GET
       ---
       responses:
         200:
           description: 成功
           schema:
             type: string
       """
    return jsonify({"status": "success", "message": "pong"})

@ping_api_bt.route('/ping', methods=['POST'])
def slowPing():
    """
       ping api - POST
       ---
       responses:
         200:
           description: 成功
           schema:
             type: string
   """
    # 模拟慢速推荐服务
    import time
    time.sleep(5)
    return jsonify({"status": "success", "message": "pong"})